<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="UTF-8">
    <title th:text="${model.getString('tabledesc')}+'- REST for R3'"></title>
    <link type="text/css" rel="StyleSheet" href="/rest.css">
    <script type="text/javascript" src="http://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script>
</head>

<div class="tle" th:inline="text">
    <a name="001">
        表：<b>[[${model.getString('tablename')}]] </b>, ID: <b>[[${model.getString('tableid')}]]</b>
        <p>
            描述：<b>[[${model.getString('tabledesc')}]]</b>

            <a th:if="${model.getBoolean('ismenu')}" target="_blank"
               href="/">进入ERP</a>

            <a target="_blank" href="/p/cs/resthome">返回数据字典</a>

        </p>
        <p th:if="${model.getBoolean('isview')}">
            <span> &nbsp;<font color='red'><b>此表为视图：请点击查看-></b></font></span>
            实际表：<a th:href="@{'/p/cs/rest?table='+${model.getIntValue('rttabid')}}" th:text="${model.getString('rtdesc')}"></a>
            
        </p>
        [[${model.getBoolean('tabcomment')}]]
    </a>

    <p>
        PK 字段: [[${model.getString('pk')}]]<br/>
        AK 字段: [[${model.getString('ak')}]]<br/>
        <!--<br/>-->
        <!---->
    <table border="0" class="table" cellpadding="0" cellspacing="10" bgcolor="#ffffff">
        <tr>
            <td valign="top">
                <div class="ns">
                    允许操作:
                    <ul>

                        <li th:if="${model.getBoolean('isadd')}"><a href="#add">新增</a></li>

                        <li th:if="${model.getBoolean('ismod')}"><a href="#modify">修改</a></li>

                        <li><a href="#query">检索字段</a></li>

                        <li th:if="${model.getBoolean('isdel')}">删除</li>

                        <li th:if="${model.getBoolean('issubmit')}">提交</li>

                    </ul>
                </div>
            </td>

            <td td valign="top">
                <div class="ns">
                    关联表：
                    <ul>

                        <li th:each="reftab : ${model.getJSONArray('reftabs')}"><a
                                th:href="@{'/p/cs/rest?table='+${reftab.getString('tableid')}}" th:text="${reftab.getString('tabledesc')}"/>
                            ([[${reftab.getString('tabrelation')}]])
                            &nbsp;reftableid:[[${reftab.getString('tableid')}]]
                        </li>

                    </ul>
                </div>
            </td>


            <td td valign="top">
                <div class="ns">
                    动作定义：名称+(ID)+描述
                    <ul>
                        <li th:each="webact : ${model.getJSONArray('webactions')}">
                            [[${webact.getName()}]] ([[${webact.getId()}]]) [[${webact.getDescription()}]]
                        </li>
                    </ul>
                </div>
            </td>


        <tr>
    </table>

    </p>
</div>
<br/>
<i>下列字段名称为红色表示不允许为空</i>

<div><textarea id="addobj" style="width: 300px;height: 200px;"></textarea><input type="text" style="width: 350px;vertical-align: top;"></input><button style="    vertical-align: top;
    margin-left: 50px;">在线测试</button></div>


<script>
    
    var testObj = {};

    testObj.param={};

    testObj.param.objid=-1;

    testObj.fixcolumn={};

    testObj.fixcolumn.[[${model.getString('tablename')}]]={};
    

    function gobj(dom){
       var val=jQuery("#"+dom+" .putval");
        for (var i = 0; i < val.length; i++) {
            testObj.fixcolumn.[[${model.getString('tablename')}]][jQuery(val[i]).attr("inname")]=jQuery(val[i]).val();
        }
        
        jQuery("#addobj").val(JSON.stringify(testObj,null,2));
    }
   


</script>
<table id="addtable" border="0" width="960" class="table" cellpadding="0" cellspacing="1" bgcolor="#dddddd">

    <tr>
        <td class="td" colspan="8">
            <a name="add"><span class="anc">新增字段组织</span></a>
            <button style="float: right" onclick="gobj('addtable')">生成测试对象</button>
        </td>
        <div th:replace="inc_column::frag(${model.get('addcolumns')})"/>
            
           
    </tr>

</table>


<table id="modtable" border="0" width="960" class="table" cellpadding="0" cellspacing="1" bgcolor="#dddddd">
    
    <tr>
        <td class="td" colspan="8">
            <a name="modify"><span class="anc">修改字段组织</span></a>
            <button style="float: right" onclick="gobj('modtable')">生成测试对象</button>
        </td>
        <div th:replace="inc_column::frag(${model.get('modcolumns')})"/>
          
    </tr>


</table>

<table border="0" width="960" class="table" cellpadding="0" cellspacing="1" bgcolor="#dddddd">
    <tr>
        <td class="td" colspan="8">
            <a name="query"><span class="anc">检索用字段</span></a>
            <br/>
        </td>
        <div th:replace="inc_column::frag(${model.get('indexcolumns')})"/>
    </tr>

</table>

<table id="alltable" border="0" width="960" class="table" cellpadding="0" cellspacing="1" bgcolor="#dddddd">

    <tr>
        <td class="td" colspan="8">
            <a name="query"><span class="anc">所有字段</span></a>
            <button style="float: right" onclick="gobj('alltable')">生成测试对象</button>
        </td>
        <div th:replace="inc_column::frag(${model.get('allcolumns')})"/>
    </tr>

</table>


</html>